import { Box, Button } from '@alifd/next';
import React from 'react';
import st from './index.module.scss';

interface Props {
  onRefresh?: () => any;
  error?: Error;
}

const EmptyBlock: React.FunctionComponent<Props> = ({ onRefresh, error }): JSX.Element => {
  return (
    <div className={st['table-empty-block']}>
      <div className={st['result-image']}>
        <img alt="data empty" src="//img.alicdn.com/tfs/TB1_yJXFkL0gK0jSZFAXXcA9pXa-1112-758.png" />
      </div>
      <div className={st['result-title']}>
        {error ? (
          <Box direction="column" justify="center">
            <Button type="secondary" onClick={onRefresh}>
              重新加载
            </Button>
          </Box>
        ) : (
          <span>数据为空</span>
        )}
      </div>
    </div>
  );
};

export default EmptyBlock;
